package org.springframework.prospring.ticket.domain.location;

import com.thoughtworks.xstream.annotations.XStreamAlias;

import java.util.Set;
import java.util.HashSet;

/**
 * Created by IntelliJ IDEA.
 * User: Alexis Quiros
 * Date: 16/07/2006
 * Time: 11:12:09
 * To change this template use File | Settings | File Templates.
 */

//esta Anotario se usa para que el controler guarde en parametro en el response con ese nombre y depues JSON lo puede tomar

@XStreamAlias("Province")
public class Province {
    Long id;
    String businessPK;
    String name;
    Set cities;


    public Province() {
    }

    public Province(Long id, String businessPK, String name) {
        this.id = id;
        this.businessPK = businessPK;
        this.name = name;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getBusinessPK() {
        return businessPK;
    }

    public void setBusinessPK(String businessPK) {
        this.businessPK = businessPK;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public Set getCities() {
        return cities;
    }

    public void setCities(Set cities) {
        this.cities = cities;
    }

    public void addCity(City city){
        if (this.cities == null){
            this.cities = new HashSet();
        }
        this.cities.add(city);
    }

    public String toString() {
        String message = "id=" +id+", name="+name+", cities=["+cities+"]";
        return message;
    }

}
